package com.sample.calendar;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Handles requests for the application home page.
 */
@Controller
public class CalendarController {
	
	private static final Logger logger = LoggerFactory.getLogger(CalendarController.class);
	
//		private static Map<String, String> map(String key, String value) {
//			Map<String, String> map = new HashMap<String, String>();
//			map.put(key, value);
//			return map;
//		}
	
	@RequestMapping(value = "/calendar.list1.json", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody 
	public List<Map<String, String>> testCalenarList1Json() {
		List<Map<String, String>> list = new ArrayList<Map<String, String>>();
		
		Map<String, String> map = null;
		map = new HashMap<String, String>();
		map.put("start", "2014-03-01 01:01:00");
		map.put("end", "2014-03-02 01:02:00");
		map.put("title", "list 1 title 1");
		
		list.add(map);

		map = new HashMap<String, String>();
		map.put("start", "2014-03-03 01:01:00");
		map.put("end", "2014-03-03 01:02:00");
		map.put("title", "list 1 title 2");

		list.add(map);
		
		return list;
	}

	@RequestMapping(value = "/calendar.list2.json", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody 
	public List<Map<String, String>> testCalenarList2Json() {
		List<Map<String, String>> list = new ArrayList<Map<String, String>>();
		
		Map<String, String> map = null;
		map = new HashMap<String, String>();
		map.put("start", "2014-03-10 01:01:00");
		map.put("end", "2014-03-11 01:02:00");
		map.put("title", "list 2 title 1");
		
		list.add(map);

		map = new HashMap<String, String>();
		map.put("start", "2014-03-13 01:01:00");
		map.put("end", "2014-03-13 01:02:00");
		map.put("title", "list 2 title 2");

		list.add(map);
		
		return list;
	}
	
}
